<?php echo $this->element('admin_header'); ?>
<div class="holder">
<div class="portfolios form">
	
<?php echo $form->create('Portfolio');?>
	<fieldset>
 		<legend><?php __('Edit Portfolio');?></legend>
	<?php
		echo $form->input('id');
		echo $form->input('Category');
		echo $form->input('title');
		echo $form->input('customer');
		echo $form->input('work_place');
		echo $form->input('url');
		echo $form->input('description');
		echo $form->input('date');
		echo $form->input('published');
	?>
	</fieldset>
	<div class="block">
		<div class="element">
			<?php echo $form->submit(__('Save', true));?>
		</div>
		<div class="element">
			<?php echo $form->submit(__('Save and close', true), array('name'=>'close'));?>
		</div>
	</div>
	<?php echo $form->end();?>
	<?php debug($this->data);?>
</div>
<div class="sidebar">
	<?php echo $form->create('Upload', array('type' => 'file', 'action'=>'external_add'));?>
		<fieldset>
	 		<legend><?php __('Add Upload');?></legend>
		<?php
			//echo $form->input('portfolio_id', array('empty'=>true));
			echo $form->hidden('portfolio_id', array('value'=>$this->data['Portfolio']['id']));
			echo $form->input('title');
			//echo $form->input('order');
			echo $form->input('filename', array('type' => 'file','label' => __('Upload a new file', true)));
		?>
		</fieldset>
	<?php echo $form->end('Submit');?>
	<fieldset>
 		<legend><?php __('Uplaods');?></legend>
		<?php foreach($this->data['Upload'] as $upload):?>
			<div class="image">
				<p><?php echo $upload['title'];?> (<?php echo $upload['order'];?>)
					<span>
					<?php echo $html->link('Edit', array('plugin'=>'portfolios', 'controller'=>'uploads', 'action'=>'edit', $upload['id']), array('target'=>'blank'))?> | 
					<?php echo $html->link('Delete', array('plugin'=>'portfolios', 'controller'=>'uploads', 'action'=>'delete', $upload['id']), array('target'=>'blank'))?>
					</span>
				</p>
				<?php echo $gershImage->resize($upload['dir'] . DS . $upload['filename'], "thumb"); ?>
			</div>
			
		<?php endforeach; ?>
	</fieldset>
</div>
</div>
<div class="actions">
	<ul>
		<li><?php echo $html->link(__('Delete', true), array('action'=>'delete', $form->value('Portfolio.id')), null, sprintf(__('Are you sure you want to delete # %s?', true), $form->value('Portfolio.id'))); ?></li>
		<li><?php echo $html->link(__('List Portfolios', true), array('action'=>'index'));?></li>
	</ul>
</div>
